<?php

class Search_Model_Apalogjumpshow extends Apm_Model_Base{

    public function getApalogjump($params)
    {

		//セキュアチェック　不正文字列存在時はエラー
		if ($this->CmnF_SecureCheck("all", $params))
		{
			print "セキュアチェックエラー 不正文字".$this->CmnF_SecureCheck("all", $params); //セキュアチェックエラー
			exit();
		} 
		
		$strShopCd = $params['ShopCd'];
		$strPrefCd = $params['PrefCd'];

		$ret = '';
		If ($strShopCd) {
			// ｸｴﾘ作成(店舗のOEM契約状況を取得する)
			$strSQL  = "SELECT M05_TENPO_CD, M05_HOUZIN_CD, M05_TENPO_TODOUFUKEN_CD, NVL(M05_OEM,0) AS M05_OEM";
			$strSQL .= " FROM M05TENPO_INFO";
			$strSQL .= " WHERE M05_TENPO_CD = :ShopCd";

			$db_params['ShopCd'] = $strShopCd;
			$rsSet = $this->dbGetData($strSQL, $db_params);
			$strOemHide='';
			if ($rsSet['M05_OEM'] == 2 || $rsSet['M05_OEM'] == 0)
			{
				$strOemHide=$strOemHide."<input type='hidden' name='OemCd' value='".$rsSet['M05_TENPO_CD']."' />"."\r\n";
			} 
			else if ($rsSet['M05_OEM'] == 1 || $rsSet['M05_OEM'] == 3)
			{
				$strOemHide=$strOemHide."<input type='hidden' name='OemCd' value='".$rsSet['M05_HOUZIN_CD']."' />"."\r\n";
			}
			
			$strOemHide=$strOemHide."<input type='hidden' name='PrefCd[]' value='".$rsSet['M05_TENPO_TODOUFUKEN_CD']."' />"."\r\n";
			$ret['strTgtHeyaCd'] = $rsSet['T03_HEYA_CD'];
		}
		else
		{
			$strOemHide=$strOemHide."<input type='hidden' name='PrefCd[]' value='".$strPrefCd."' />"."\r\n";
		}
		$strOemHide=$strOemHide."<input type='hidden' name='UseKbn' value='1' />"."\r\n";
		$ret['strOemHide'] = $strOemHide;
		return $ret;
	}

    function CmnF_SecureCheck($value, $params)
	{
		$charactor=array("?","&","%",";","\'","--","<",">","\"");
		$function_ret="";
		
		foreach ($params as $key => $val) {
			for ($i=0; $i<=count($charactor); $i=$i+1)
			{
				if ((strpos($val,$charactor[$i]) ? strpos($val,$charactor[$i])+1 : 0))
				{
					$function_ret=$charactor[$i];
					break;
				} 
			}
		}

		return $function_ret;
	} 

}
?>
